<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.weifly.jettycn.domain.Catalog" %>
<%@ page import="com.weifly.jettycn.util.TreeNode" %>
<%
	request.setAttribute("editorTextArea", "release_desc");
	String project = request.getParameter("project");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>添加release</title>
    <%@include file="/comhead.jsp" %>
    <jsp:include page="/pub/kindeditor/kindeditor.jsp"/>
    <script type="text/javascript">

    // 插入release事件
	function insertReleaseHandler(){
		var msgs = [];
		var name = $("#release_version").attr("value");
		if(Tas.isEmpty(name)){
			msgs.push("版本不能为空");
		}
		var publishdate = $("#release_publishdate").attr("value");
		if(Tas.isEmpty(publishdate)){
			msgs.push("发布日期不能为空");
		}
		if(msgs.length>0){
			Tas.showError(msgs);
		}else{
			Tas.hideMessageArea();
			kindEditor1.sync();
			$("#releaseForm").ajaxSubmit(function(response, statusText){
				response = $.parseJSON(response);
				if(response.success){
					var project = $("#release_prjid").attr("value");
					window.location.assign("releaseList.do?project=" + project);
				}else{
					Tas.showError(response.messages);
				}
			});
		}
	}
    
    $(document).ready(function(){
		$("#release_submit").click(insertReleaseHandler);
    });
    </script>
  </head>
  <body>
    <h3>添加发布版（release）</h3>
    <%@include file="/message.jsp" %>
    <form id="releaseForm" action="insertRelease.do" method="post">
    <table class="table_show1" border="1px" bordercolor="#ccbbaa">
      <tr>
        <td>版本：</td>
        <td>
          <input id="release_prjid" name="release_prjid" value="<%=project%>" type="hidden">
          <input id="release_version" name="release_version" style="width: 240px;">
        </td>
      </tr>
      <tr>
        <td>发布日期：</td>
        <td>
          <input id="release_publishdate" name="release_publishdate" style="width: 240px;">
          <span>日期示例：2011-10-10</span>
        </td>
      </tr>
      <tr>
        <td>描述：</td>
        <td>
          <textarea id="release_desc" name="release_desc" cols="100" rows="8" style="width:700px;height:200px;visibility:hidden;"></textarea>
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <button id="release_submit" type="button">确定</button>
        </td>
      </tr>
    </table>
    </form>
  </body>
</html>